﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Master/FrameMain.Master" AutoEventWireup="true" CodeBehind="CardGenerate.aspx.cs" Inherits="FortuneHeaven.Admin.Pages.GameManager.CardGenerate" %>
<%@ Import Namespace="FortuneHeaven.Admin.Common" %>
<%@ Register TagPrefix="uc1" TagName="Pagination" Src="~/Controls/Pagination.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link  type="text/css"  rel="Stylesheet" href="../../Content/CSS/newsdetail.css"/>
<script>

    function checknumber() {
        var t1 = $('#<%=tbValueType.ClientID%>');
        if (!t1.val()) {
            alert("请输入生成数目");
            return false;
        }
        if (t1.val() > 100) {
            alert("生成太多会导致系统繁忙，请一次最多生成100张");
            return false;
        }
        return true;
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="toolbar" >
    <div style=" text-align:center">
         <strong>卡号生成</strong>
    </div>
    </div>
     <table  width="100%" cellspacing="1" cellpadding="2" border="0" align="center" class="border">
            <tbody>
             
                <tr>
                    <td width="10%" height="23" class="tdbg">
                      生成面额:
                    </td>
                    <td width="20%" class="tdbg">
                     <asp:DropDownList ID="dpValueType" runat="server"></asp:DropDownList>
                    </td>
                    <td width="10%" height="23" class="tdbg">
                      网吧:
                    </td>
                    <td width="62%" class="tdbg">
                     <asp:DropDownList ID="dpNetBar" runat="server" DataTextField="Name" 
                            DataValueField="ID">
                         <asp:ListItem Value="0">[不确定]</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td width="10%" height="23" class="tdbg">
                       生成数目:
                    </td>
                    <td width="20%" class="tdbg">
                     <asp:TextBox ID="tbValueType" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                         ID="rfValueType" runat="server" ValidationGroup="Gen"  Display="Dynamic" ControlToValidate="tbValueType"  ErrorMessage="必填"></asp:RequiredFieldValidator>
                     
                     <asp:RegularExpressionValidator
                         ID="reValueType" runat="server" ControlToValidate="tbValueType" 
                            ErrorMessage="输入正整数" ValidationGroup="Gen" Display="Dynamic" 
                            ValidationExpression="^[0-9]*[1-9][0-9]*$" EnableClientScript="true" ></asp:RegularExpressionValidator>
                    </td>
                    <td width="10%" height="23" class="tdbg">
                       卡号前三位:
                    </td>
                    <td width="62%" class="tdbg">
                        <asp:TextBox ID="tbNum"  runat="server" MaxLength="3" Width="59px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfNum" ValidationGroup="Gen" ControlToValidate="tbNum" Display="Dynamic" runat="server" ErrorMessage="必填"></asp:RequiredFieldValidator>
                        
                        <asp:RegularExpressionValidator
                         ID="reNum" runat="server" ControlToValidate="tbNum" 
                            ErrorMessage="填三位数字" ValidationGroup="Gen" Display="Dynamic" 
                            ValidationExpression="[0-9][0-9][0-9]" EnableClientScript="true" ></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                <td></td>
                   <td colspan="3">
                    <asp:Button runat="server" ID="btnAddItem" CssClass="buttoncss"  
                           Text="生成" OnClick="Generate" 
                           ValidationGroup="Gen" />
                    <asp:Button runat="server" ID="Button1" CssClass="buttoncss" 
                            Text="生成并导出" OnClick="GenerateAndSaveTxt" 
                           ValidationGroup="Gen" />
                    <asp:Button runat="server" ID="Button2" CssClass="buttoncss" Text="刷新列表" OnClick="ListUpdate" />
                   <asp:Button runat="server" ID="bt" CssClass="buttoncss" Text="批量生效" 
                           onclick="bt_Click" />
                   </td>
                </tr>
            </tbody>
        </table>
    <div  class="showhead" >
    <div style=" text-align:center">
         <strong>卡号列表</strong>
    </div>
    </div>
    <div id="head">
        <div class="left">
            <asp:Label ID="lblDeptName" runat="server" Font-Bold="true"></asp:Label>
            <asp:Label ID="lblStatistic" runat="server"></asp:Label>
        </div>
        <div class="right">
                    <asp:Label ID="Label1" runat="server" Text="网吧:"></asp:Label>
            <asp:DropDownList ID="drpNetBar2" AutoPostBack="true" runat="server" OnSelectedIndexChanged="drpNetBar_SelectedIndexChanged" DataTextField="Name" 
                            DataValueField="ID">
                                     <asp:ListItem Value="0">所有记录</asp:ListItem>
            </asp:DropDownList>
            <asp:Label ID="lbGiftOrder" runat="server" Text="状态:"></asp:Label>
            <asp:DropDownList ID="drpStatus" AutoPostBack="true" runat="server" OnSelectedIndexChanged="drpStatus_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:Label ID="lblShow" runat="server" Text="显示:"></asp:Label>
            <asp:DropDownList ID="drpPagerSize" AutoPostBack="true" runat="server" OnSelectedIndexChanged="drpPagerSize_SelectedIndexChanged">
            </asp:DropDownList>
        </div>
    </div>    
    <asp:ListView ID="lvNews" runat="server" EnableViewState="true" EnableModelValidation="True">
        <LayoutTemplate>
            <div id="list">
                <table id="lvList" cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <th class="sp">
                            &nbsp;
                        </th>
                         <th class="chk">
                            <input id="chkSelectAll" type="checkbox" onclick="SelectAll2();" />
                        </th>
                        <th>
                            网吧
                        </th>
                        
                        <th>
                            卡号
                        </th>
                        <th>
                            金额
                        </th>
                        <th>
                            状态
                        </th>
                        <th>
                            创建时间
                        </th>
                        <th>
                            充值帐号
                        </th>
                        
                    </tr>
                    <tbody>
                        <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                    </tbody>
                </table>
            </div>
        </LayoutTemplate>
        <AlternatingItemTemplate>
            <tr>
                <td class="sp">
                    &nbsp;
                </td>
                
                <td>
                    <asp:CheckBox ID="cbCard" runat="server" Enabled='<%#( int.Parse(Eval("Status").ToString())<1) %>' CssClass='<%#Eval("ID") %>' Checked="false" onload="cbCard_Load"  />
                    <asp:HiddenField ID="hfIDs" runat="server" Value='<%# Eval("ID")%>' />
                </td>
                <td>
                    <%# GetBarName(int.Parse(Eval("NetBarId").ToString()))%>
                    
                </td>
                <td>
                    <%#ShowCode(Eval("RechargeCode").ToString())%>
                    
                </td>
                <td>
                    <%# Eval("RechargeValue")%>
                </td>
                <td>
                    <%# ((int)Eval("Status") == 0?"停用":((int)Eval("Status")==1?"启用":"已用"))%>
                </td>
                <td>
                    <%# Eval("CreateTime")%>
                </td>
                 <td>
                    <%# (string.IsNullOrEmpty((string)Eval("UserName")) ? "[无]" : Eval("UserName"))%>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table id="Table2" runat="server">
                <tr>
                    <td>
                        没有记录.
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <ItemTemplate>
            <tr>
                 <td class="sp">
                    &nbsp;
                </td>
                
                <td>
                    <asp:CheckBox ID="cbCard" runat="server" Enabled='<%#( int.Parse(Eval("Status").ToString())<1) %>' CssClass='<%#Eval("ID") %>' Checked="false" onload="cbCard_Load"  />
                    <asp:HiddenField ID="hfIDs" runat="server" Value='<%# Eval("ID")%>' />
                </td>
                <td>
                    <%# GetBarName(int.Parse(Eval("NetBarId").ToString()))%>
                    
                </td>
                <td>
                    <%#ShowCode(Eval("RechargeCode").ToString())%>
                    
                </td>
                <td>
                    <%# Eval("RechargeValue")%>
                </td>
                <td>
                    <%# ((int)Eval("Status") == 0?"停用":((int)Eval("Status")==1?"启用":"已用"))%>
                </td>
                <td>
                    <%# Eval("CreateTime")%>
                </td>
                 <td>
                    <%# (string.IsNullOrEmpty((string)Eval("UserName")) ? "[无]" : Eval("UserName"))%>
                </td>
            </tr>
        </ItemTemplate>
    </asp:ListView>
    <div id="foot">
        <div class="foot_left">
        </div>
        <div class="foot_right">
            <uc1:Pagination ID="usPager" runat="server" />
        </div>
    </div>
</asp:Content>